<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>ASCLL码转换器</title>
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
    <style>
        body { background-color: #f8f9fa; font-family: 'Roboto', sans-serif; }
        .container { max-width: 600px; margin: 100px auto; padding: 40px; background-color: #fff; border-radius: 20px; box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1); }
        h1 { color: #343a40; font-size: 2.5rem; margin-bottom: 30px; }
        textarea { resize: none; border-radius: 10px; padding: 20px; font-size: 1.1rem; }
        button { margin-right: 10px; padding: 15px 30px; border-radius: 10px; background-color: #007bff; color: #fff; border: none; cursor: pointer; font-size: 1.1rem; }
        button:hover { background-color: #0056b3; }
        .btn-secondary { background-color: #6c757d; }
        .btn-secondary:hover { background-color: #5a6268; }
    </style>
</head>
<body>
    <div class="container">
        <h1 class="text-center mb-4">ASCLL码转换器</h1>
        <textarea id="inputText" placeholder="输入文本" class="form-control mb-3"></textarea>
        <div class="d-flex justify-content-center">
            <button onclick="textToAscii()" class="btn btn-primary me-2">文本转ASCLL</button>
            <button onclick="asciiToText()" class="btn btn-secondary">ASCLL转文本</button>
        </div>
        <textarea id="outputText" placeholder="输出结果" class="form-control mt-3"></textarea>
    </div>

    <script>
        function textToAscii() {
            const input = document.getElementById('inputText').value;
            const ascii = input.split('').map(char => char.charCodeAt(0)).join(' ');
            document.getElementById('outputText').value = ascii;
        }

        function asciiToText() {
            const input = document.getElementById('inputText').value;
            const text = input.split(' ').map(code => String.fromCharCode(code)).join('');
            document.getElementById('outputText').value = text;
        }
    </script>
</body>
</html>